// yuv_as_rgb.h (/Win32) --------------------------------------------------
// contains defenition for basic Image/Windows bitmap manipulations 
// for video compression project
//
// (C) 2001, Streambox Inc.
// All Rights Reserved. 
//
// implemented YUVToRGB, RGBToYUV
//----------------------------------------------------------------------------

#ifndef _YUV_AS_RGB_H_
#define _YUV_AS_RGB_H_


#include <windows.h>
#include <mmsystem.h>
#include <vfw.h>
#include "../Common/cTypes.h"

#ifdef __cplusplus
extern "C" {
#endif



//---------------------------------------------------------------------------
#if defined(_J707_) // merge from VC-XR2:#103R210001: KAZUHY
void YUY2ToRGB(BYTE *YUY2Buffer, BYTE *RGBBuffer, int width, int height);
#endif

void  YUVToRGB(BYTE* RGBBuffer, BYTE* YBuffer, BYTE* UBuffer, BYTE* VBuffer,  int width, int height);

void  RGBToYUV(BYTE* RGBBuffer, BYTE* YBuffer, BYTE* UBuffer, BYTE* VBuffer, int width, int height,int org_w,int Inverse_Fields);

void YUV422(BYTE* pbY, BYTE* pbU, BYTE* pbOut,int w, int h);

void YUV444(BYTE* pbIn, BYTE* pbU, BYTE* pbV,int w, int h);

void INTEL_RGBToYUV422(BYTE* RGBBuffer, BYTE* YBuffer, BYTE* UVBuffer, int width, int height, int org_w, int inv);

#if defined(_J77_) // merge from VC-XR2:#103R210001: TOMOKOH
void  INTEL_YUY2ToYUV422(BYTE* pFrame, BYTE* YBuffer, BYTE* UVBuffer, int width, int height, int byteWidth, int inv); // Added by KAZUHY - VCX103R2:#VS2008
void  INTEL_YVYUToYUV422(BYTE* YUY2Buffer, BYTE* YBuffer, BYTE* UVBuffer, int width, int height, int byteWidth,int inv); // Added by KAZUHY - VCX103R2:#VS2008
#endif
void  INTEL_UYVYToYUV422(BYTE* UYVYBuffer, BYTE* YBuffer, BYTE* UVBuffer, int width, int height, int byteWidth,int inv,int dst_w);
void  INTEL_I420oYUV422(BYTE* I420Buffer, BYTE* YBuffer, BYTE* UVBuffer, int width, int height, int byteWidth,int inv);

//************************ YUV_Decompress *****************************
extern HIC		YUV_Decompress_HIC;
extern long		SampleNo;
extern BITMAPINFOHEADER	biOut, biIn;


void YUV_Decompress_Test(PAVISTREAM	pavis, LPBITMAPINFOHEADER biFmt);
void YUV_Decompress_GetFrame(PAVISTREAM	pavis,  
							 BYTE *Pk_buf, BYTE *UYVY_buf, BYTE *Y_buf, 
							 BYTE *UV_buf,int inv,int dst_w);
void YUV_Decompress_Close(void);

#ifdef __cplusplus
}
#endif

#endif
